package com.example.test.service.Impl;
import com.example.test.entity.Message;
import com.example.test.mapper.MessageMapper;
import com.example.test.service.Messageservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class MessageserviceImpl implements Messageservice {
    @Autowired
    private MessageMapper messageMapper;


    @Override
    public boolean findByName(String from, String to) {
        boolean flag = false;
        flag = messageMapper.findByName(from, to);
        return flag;
    }

    @Override
    public boolean InsertMessage(String from, String text, String to,Integer id) {
        boolean flag = messageMapper.InsertMessage(from, text, to,id);
        return flag;
    }

    @Override
    public String Insert(Message message) {
        return "0";
    }

    @Override
    public List<Message> getMessage() {
        return messageMapper.getMessage();

    }
    @Override
    public List<Message> getMessagesBetween(@PathVariable String from, @PathVariable String to) {
        return messageMapper.getMessagesBetween(from, to);
    }
}
